<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/4/9
  Time: 19:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>平台登录</title>
    <link href="css/bootstrap.min.css" type="text/css"
          rel="stylesheet">
    <script type="text/javascript" src="js/jquery-3.2.1.js"></script>
    <link href="css/login.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="login">
    <div class="message">考勤管理系统-人员登录</div>
    <div id="darkbannerwrap"></div>

    <form>
        <input id="uname" placeholder="用户名" required="" type="text" >
        <hr class="hr15">
        <input id="pwd" placeholder="密码" required="" type="password">
        <hr class="hr15">
        <input value="登录" style="width:100%;" type="submit" onclick="login()">
        <hr class="hr20">
        <!-- 帮助 <a onClick="alert('请联系管理员')">忘记密码</a> -->
    </form>
</div>
</body>
<script>
    function login() {
        var username = $("#uname").val();
        var password = $("#pwd").val();
        $.ajax({
            url: "${pageContext.request.contextPath}/login/employeeLogin",
            type: "post",
            data: {"eName": username, "ePwd": password},
            contentType: "application/x-www-form-urlencoded",
            dataType: "json",
            success: function (data) {
                if (data.info == "登录成功！") {
                    window.location.href = "index.jsp";
                }else {
                    window.alert(data.info);
                }
            }
        });
    }
</script>

<script type="text/javascript">
<%--    退出登录后让游览器后退键失效--%>
    $(function(){
        if(window.history && window.history.pushState){
            $(window).on("popstate", function(){
                window.history.pushState("forward", null, "#");
                window.history.forward();
            });
        }
        window.history.pushState("forward", null, "#"); //在IE中必须得有这两行
        window.history.forward();
    });
</script>
</html>
